// Camera Scene Node
// (c) jimon game studio

#ifndef JEH_ICAMERASCENENODE
#define JEH_ICAMERASCENENODE

#include "ISceneNode.h"
#include "jeFrustum.h"

namespace je
{
	namespace scene
	{
		//! Camera Scene Node
		class ICameraSceneNode:public je::scene::ISceneNode
		{
		public:
			//! Constructor
			ICameraSceneNode(video::IRender * Render,const jeStringd & SetNodeName)
				:ISceneNode(Render,SetNodeName)
			{
			}

			//! Destructor
			virtual ~ICameraSceneNode()
			{
			}

			//! Apply Transforms
			virtual void ApplyTransforms() = 0;

			//! Get Frustum
			virtual jeFrustum * GetFrustum() = 0;

			//! Camera Mode
			enum CameraMode
			{
				//! 2d Camera Mode
				CM_2D,

				//! 3d Camera Mode
				CM_3D
			};

			//! Camera Options
			struct CameraOptions
			{
				//! Camera Mode
				CameraMode CurrentMode;

				//! Fov
				f32 CurrentFov;

				//! Near
				f32 CurrentNear;

				//! Far
				f32 CurrentFar;

				//! Screen Size Space
				u1 CurrentScreenSizeSpace;

				//! Center in middle of viewport
				u1 CurrentCenterInMiddleOfViewport;

				//! Left Right
				jeVector2df CurrentLeftRight;

				//! Bottom Top
				jeVector2df CurrentBottomTop;

				//! Look At
				jeVector3df CurrentLookAt;

				//! Up
				jeVector3df CurrentUp;

				//! Constructor
				CameraOptions(jeVector3df LookAt = jeVector3df(0,0,-1),jeVector3df Up = jeVector3df(0,1,0))
					:CurrentLookAt(LookAt),CurrentUp(Up)
				{
				}

				//! Set 3D
				CameraOptions & Set3D(f32 Fov = 45.0f,f32 Near = 0.01f,f32 Far = 1000.0f)
				{
					CurrentMode = CM_3D;
					CurrentFov = Fov;
					CurrentNear = Near;
					CurrentFar = Far;
					return *this;
				}

				//! Set 2D
				CameraOptions & Set2D(u1 ScreenSizeSpace = true,u1 CenterInMiddleOfViewport = true,f32 Near = -1.0f,f32 Far = 1.0f,jeVector2df LeftRight = jeVector2df(-1,1),jeVector2df BottomTop = jeVector2df(-1,1))
				{
					CurrentMode = CM_2D;
					CurrentScreenSizeSpace = ScreenSizeSpace;
					CurrentCenterInMiddleOfViewport = CenterInMiddleOfViewport;
					CurrentNear = Near;
					CurrentFar = Far;
					CurrentLeftRight = LeftRight;
					CurrentBottomTop = BottomTop;
					return *this;
				}
			};

			//! Set Camera Options
			virtual void SetCameraOptions(const CameraOptions & Options) = 0;

			//! Get Camera Options
			virtual const CameraOptions & GetCameraOptions() = 0;

			//! Viewport Options
			struct ViewportOptions
			{
				//! Full Size Viewport
				u1 CurrentFullSizeViewport;

				//! Current Position
				jeVector2di CurrentPosition;

				//! Current Size
				jeVector2di CurrentSize;

				//! Constructor
				//! Viewport - screen context, so if you render to texture, you need to set texture size there
				ViewportOptions(u1 FullSizeViewport = true,jeVector2di Position = jeVector2di(),jeVector2di Size = jeVector2di())
					:CurrentFullSizeViewport(FullSizeViewport),CurrentPosition(Position),CurrentSize(Size)
				{
				}
			};

			//! Set Viewport Options
			virtual void SetViewportOptions(const ViewportOptions & Options) = 0;

			//! Get Viewport Options
			virtual const ViewportOptions & GetViewportOptions() = 0;
		};
	}
}

#endif
